import { IsString, IsNotEmpty, IsOptional, IsNumber } from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class WalletAuthDto {
    @ApiProperty({
        description: 'Ethereum wallet address (42 characters starting with 0x)',
        example: '0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6',
        minLength: 42,
        maxLength: 42,
        pattern: '^0x[a-fA-F0-9]{40}$'
    })
    @IsString()
    @IsNotEmpty()
    walletAddress: string;

    @ApiProperty({
        description: 'Blockchain chain ID',
        example: 1,
        minimum: 1
    })
    @IsNumber()
    @IsNotEmpty()
    chainId: number;

    @ApiProperty({
        description: 'Message that was signed by the wallet',
        example: 'Welcome to RWA Platform! Please sign this message to authenticate.',
        minLength: 10
    })
    @IsString()
    @IsNotEmpty()
    message: string;

    @ApiProperty({
        description: 'Cryptographic signature of the message',
        example: '0x1234567890abcdef...',
        minLength: 130,
        maxLength: 132,
        pattern: '^0x[a-fA-F0-9]{130}$'
    })
    @IsString()
    @IsNotEmpty()
    signature: string;

    @ApiPropertyOptional({
        description: 'Optional full name of the user',
        example: 'John Doe',
        required: false
    })
    @IsString()
    @IsOptional()
    fullName?: string;
}
